﻿using System;

namespace WebCrawler
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");

            CrawlerOption coption = new CrawlerOption(){
                StartUrl = "http://www.itdks.com/dakashuo/playback/965",
                TargetPath = AppDomain.CurrentDomain.BaseDirectory+"/files/",
                SubPage = new SubPageOption(){
                    LinkType = LinkTypeEnum.Page,
                    Name = "分会场",
                    MatchExpression = @"<div class=""course-infos"".*?<a.*?href=""(?<link>/dakashuo/playback/\d+)"">.*?<h2>(?<title>.*?)</h2></a>",
                    SubPage = new SubPageOption(){
                        LinkType = LinkTypeEnum.Page,
                        Name = "演讲",
                        MatchExpression = @"<div class=""course-infos techer"">.*?<a.*?href=""(?<link>/dakashuo/detail/\d+)"">.*?<h2>(?<title>.*?)</h2></a>",
                        SubPage = new SubPageOption(){
                            LinkType = LinkTypeEnum.File,
                            Name = "演讲文件",
                            MatchExpression = @"<a href=""(?<link>/dakashuo/\d+/material/\d+/download)"".*?<p.*?>(?<title>.*?)</p>"
                        }
                    }
                }
            };
            HttpCrawler crawler = new HttpCrawler(coption);
            crawler.Start();
        }
    }
}
